
*------------------------------------------------------------------------------------
* Uganda Attitudes
* Purpose: Variable preparation for LASSO

* Notes: 
* 0. lasso variables in the baseline and the listing are classified into three categories: likert, continuous, and categorical
* 1. likert scales are transformed into binary measures; neutrals are resolved towards the smaller group
* 2. likert variables w/ option "Don't know" (e.g. b_c1) are treated as categorical variables: -99 denotes "Don't know"; 1 denotes "Strongly agree/Somewhat agree"; 0 denotes "Somewhat disagree/Strongly disagree"
* 3. likert variables skipped due to survey logic flow (e.g. b_c21) are treated as categorical variable: : -97 denotes skipped; 1 denotes "Strongly agree/Somewhat agree"; 0 denotes "Somewhat disagree/Strongly disagree"
* 4. categorical variables are transformed into dummies (each dummy corresponds to one category)
* 5. monetary measures are winsorized and taken inverse hyperbolic sine
* 6. questions skipped due to survey logic flow are filled
* 7. missing values for control variables are replaced with the mean
* 8. midline and endline data are harmonized according to variable_question_updated
*------------------------------------------------------------------------------------

*++++++++++++++ Data Clean +++++++++++++*

** Correct labels of b_e12 **
label variable b_e12 "E12: How many people from other countries live in [village_name]? Many, some, few, or none?"
	note b_e12: "E12: How many people from other countries live in [village_name]? Many, some, few, or none?"
	label define b_e12 1 "Many" 2 "Some" 3 "Few" 4 "None" 
	label values b_e12 b_e12

** Correct labels of b_e19 **
	label define b_e19 1 "Very Safe" 2 "Somewhat safe" 3 "Neutral" 4 "Somewhat unsafe" 5 "Very unsafe"
	label values b_e19 b_e19
	
** Correct labels of s1 **
	label define b_s1 1 "Luganda" 2 "English" 3 "Swahili" 4 "Other"
	label values b_s1 b_s1

** Clean listing **
replace ls_e10 = ls_e10*1000 if ls_e10 < 1000

*======= Listing Data ======*
* B4. What is your gender?
gen cat_ls_b4 = .
replace cat_ls_b4 = 1 	if ls_b4 == 1
replace cat_ls_b4 = 0 	if ls_b4 == 2

* E2. Have you ever owned and managed a business in a different neighborhood?
gen cat_ls_e2 = .
replace cat_ls_e2 = 1 	if ls_e2 == 1
replace cat_ls_e2 = 0 	if ls_e2 == 2

* E3. How many years of experience, in total, do you have owning and managing businesses in the sector?
gen con_ls_e3 = .
replace con_ls_e3 = ls_e3 if cat_ls_e2 == 1
replace con_ls_e3 = 0 if cat_ls_e2 == 0

* E4. Have you ever owned a business outside of the sector?
gen cat_ls_e4 = .
replace cat_ls_e4 = 1 	if ls_e4 == 1
replace cat_ls_e4 = 0 	if ls_e4 == 2

* E6. How many years of experience, in total, do you have owning and managing businesses outside of the sector?
gen con_ls_e6 = .
replace con_ls_e6 = ls_e6 if cat_ls_e4 == 1
replace con_ls_e6 = 0 if cat_ls_e4 == 0

* E7. How many employees worked at this business within the past 30 days? Do not include yourself or any of your household members.
gen con_ls_e7 = ls_e7

* E8. How many members of your household, other than yourself, worked at this business within the past month?
gen con_ls_e8 = ls_e8

* E9. Can you estimate the value of all of the capital this business currently owns (UGX)?
gen con_ls_e9 = ls_e9
winsor2 con_ls_e9, replace cuts(1 99)
qui sum con_ls_e9, de
replace con_ls_e9 = `r(mean)' 	if con_ls_e9 == . // 12 obs missing 

* E14. If an inexperienced asked you to mentor them, would you consider serving as a mentor?
gen cat_ls_e14 = ls_e14
replace cat_ls_e14 = -97 if cat_ls_e14 == . // this question is asked only if sector_experience >= 3

* Experience
gen con_ls_experience = ls_experience

* Sector
gen cat_ls_sector_name = ls_sector_name

*======= Baseline Data ======*

* Age
drop b_age
gen b_age_tmp = ls_b3a
replace b_age_tmp = 21.5 	if ls_b3b == 1
replace b_age_tmp = 28 		if ls_b3b == 2
replace b_age_tmp = 33	 	if ls_b3b == 3
replace b_age_tmp = 38	 	if ls_b3b == 4
replace b_age_tmp = 43	 	if ls_b3b == 5
replace b_age_tmp = 48	 	if ls_b3b == 6
replace b_age_tmp = 58 		if ls_b3b == 8
gen b_age = b_age_tmp 		if b_lic4 == 1
replace b_age = b_lic5 		if b_lic4 == 2
replace b_age = b_age_tmp 	if b_age == . // one missing in sample
order b_age, a(b_lic5)
gen con_b_age = b_age

* Education
gen b_years_edu = b_p12 - 1
gen con_b_years_edu = b_years_edu

***** Module P
* P1: Are you the head of your household?
gen cat_b_p1 = .
replace cat_b_p1 = 1 	if b_p1 == 1
replace cat_b_p1 = 0 	if b_p1 == 2

* P2: What is your marital status?
gen cat_b_p2 = b_p2

* P3: How many adults (18 years and older)
gen con_b_p3 = b_p3

* P4: How many children (under 18 years old) live in your household?
gen con_b_p4 = b_p4

* P5: How many of those ${P4} children are 5 years or younger?
replace b_p5 = 0 if b_p4 == 0 | b_p4 < 0
replace b_p5 = 2 if b_p5 == -2
gen con_b_p5 = b_p5

* P6: What region of Uganda were you born in?
gen cat_b_p6 = b_p6

* P7: What district were you born in?
gen cat_b_p7 = b_p7

* P8: How many years have you been living in Kampala?
replace b_p8 = 2019 - b_p8 + 1 if b_p8 > 100
replace b_p8 = b_age if b_p7 == 1
gen con_b_p8 = b_p8

* P9: What is your tribe?
gen cat_b_p9 = b_p9

* P10: What is (was) the tribe of your spouse?
gen cat_b_p10 = b_p10 
replace cat_b_p10 = -97 	if cat_b_p2 == 2 // 686 single respondents

* P11: How important would you say your tribe is to you?
gen lik_b_p11 = b_p11

* P12: What is the highest level of formal education you have completed? 
gen cat_b_p12 = b_p12

* P13: What is your religion?
gen cat_b_p13 = b_p13

* P14: In the last 7 days, how many religious services have you attended?
replace b_p14 = b_p14/30 if b_p14 >20
gen con_b_p14 = b_p14
replace con_b_p14 = 0 	if cat_b_p13 == 6 // assign 0 to 2 atheists

* P15: Were you or any one of your close family members displaced or had to move due to conflict?
gen cat_b_p15 = .
replace cat_b_p15 = 1 	if b_p15 == 1
replace cat_b_p15 = 0 	if b_p15 == 2

* P16: Who?
// multiple responses

***** Module B
* B1: What year did this business open in this location?
gen con_b_b1 = b_b1

* B2: Who provided the start-up capital for this business?
gen cat_b_b2 = b_b2

* B3: When the business opened in ${B1}, were you the manager?
gen cat_b_b3 = .
replace cat_b_b3 = 1 	if b_b3 == 1
replace cat_b_b3 = 0 	if b_b3 == 2

* B4: What year did you start working at this business?
gen con_b_b4 = b_b4
replace con_b_b4 = b_b1 	if cat_b_b3 == 1 // assign opening year to 1321 people who were managers when the business started

* B5: What year did you become the manager at this location?
gen con_b_b5 = b_b5
replace con_b_b5 = b_b1 	if cat_b_b3 == 1 // assign opening year to 1321 people who were managers when the business started

* B6: How many years have you been working in the ${ls_sector} sector?
replace b_b6 = 2019 - b_b6 + 1 if b_b6 > 100
gen con_b_b6 = b_b6 

* B7-B8: Have you taken part in an unpaid training program?
gen cat_b_b7 = .
replace cat_b_b7 = 1 		if b_b7v1 == 1
replace cat_b_b7 = 1 		if b_b7v1 == 2 & b_b8 == 1
replace cat_b_b7 = 0 		if b_b7v1 == 2 & b_b8 == 2
replace cat_b_b7 = 0 		if b_b7v2 == 1
replace cat_b_b7 = 1 		if b_b7v2 == 2 & b_b8 == 1
replace cat_b_b7 = 0 		if b_b7v2 == 2 & b_b8 == 2 
replace cat_b_b7 = ls_e11 	if b_b7v1 == . & b_b7v2 == . // 5 people missing whether they participate in the training program or not; use listing informataion

* B9: Did you do that unpaid training at a formal training institute or at the business of another entrepreneuer?
gen cat_b_b9 = .
replace cat_b_b9 = ls_e12 	if b_b7v1 == 1
replace cat_b_b9 = b_b9 	if b_b7v1 == 2 & b_b8 == 1
replace cat_b_b9 = b_b9 	if b_b7v2 == 2 & b_b8 == 1
replace cat_b_b9 = -97 		if cat_b_b7 == 0 // 86 people didn't participate in training
replace cat_b_b9 = ls_e12 	if b_b7v1 == . & b_b7v2 == . & ls_e11 == 1 // 5 people missing whether they participate in the training program or not; use listing information

* B10: In total, how many weeks did you spend in those unpaid training programs?
gen con_b_b10 = .
replace con_b_b10 = ls_e13 		if b_b7v1 == 1
replace con_b_b10 = b_b10 		if b_b7v1 == 2 & b_b8 == 1
replace con_b_b10 = b_b10 		if b_b7v2 == 2 & b_b8 == 1
replace con_b_b10 = ls_e13 		if b_b7v1 == . & b_b7v2 == . & ls_e11 == 1 // 5 people didn't answer their participation in training; use listing information
qui sum con_b_b10, de
replace con_b_b10 = `r(mean)' 	if cat_b_b7 == 1 & con_b_b10 == . // 1 obs missing for people participated in training
replace con_b_b10 = 0 			if cat_b_b7 == 0 & con_b_b10 == . // 86 people didn't participate in training

* B11: What year did you start?
replace b_b11 = 2000 if b_b11 == 20000 
replace b_b11 = 2001 if b_b11 == 3201 
replace b_b11 = b_b11 + 2000 if b_b11 < 100
gen con_b_b11 = b_b11 		if cat_b_b7 == 1
qui sum con_b_b11, de
replace con_b_b11 = `r(mean)' 	if cat_b_b7 == 1 & con_b_b11 == . // 23 obs missing for people participated in training (including 5 people didn't answer their participation in training)
replace con_b_b11 = `r(max)' 	if cat_b_b7 == 0 & con_b_b11 == . // 86 people didn't participate in training

* B12: How much did it cost in total?
replace b_b12 = b_b12 * 1000 if b_b12 < 1000
replace b_b12 = 2000 if b_b12 == 2002
gen con_b_b12 = b_b12 		if cat_b_b7 == 1
winsor2 con_b_b12, replace cuts(1 99)
qui sum con_b_b12, de
replace con_b_b12 = `r(mean)' 	if cat_b_b7 == 1 & con_b_b12 == . // 45 obs missing (including 5 people didn't answer their participation in training)
replace con_b_b12 = 0 			if cat_b_b7 == 0 & con_b_b12 == . // 86 people didn't participate in training
// 2 people didn’t participate in unpaid training program according to b7v1, b7v2, and b8 but still answered b11 and b12

* B13: Have you ever had an apprentice or person from outside your household at your household at your business who was learning skills but not paid?
gen cat_b_b13 = .
replace cat_b_b13 = 1 	if b_b13 == 1
replace cat_b_b13 = 0 	if b_b13 == 2

* B14: How many?
replace b_b14 = 10 if b_b14== 10000
gen con_b_b14 = b_b14 		if cat_b_b13 == 1
qui sum con_b_b14, de
replace con_b_b14 = `r(mean)' 	if cat_b_b13 == 1 & con_b_b14 == . // 1 obs missing
replace con_b_b14 = 0 			if cat_b_b13 == 0 & con_b_b14 == . // assign 0 to 665 people who has no apprentice

* B15: Were any from tribes different from yours?
gen cat_b_b15 = .
replace cat_b_b15 = 1 		if b_b15 == 1
replace cat_b_b15 = 0 		if b_b15 == 2
replace cat_b_b15 = -97		if b_b15 == . & cat_b_b13 == 0 // 665 people didn't have apprentice

* B16: Were any from other nationalities?
gen cat_b_b16 = .
replace cat_b_b16 = 1 		if b_b16 == 1
replace cat_b_b16 = 0 		if b_b16 == 2
replace cat_b_b16 = -97 	if b_b16 == . & cat_b_b13 == 0 // 665 people didn't have apprentice

* B17: Which nationalities?
// multiple responses

* B18: Do you currently have any apprentices at your businesses?
gen cat_b_b18 = .
replace cat_b_b18 = 1 	if b_b18 == 1
replace cat_b_b18 = 0 	if b_b18 == 2
replace cat_b_b18 = 0 	if cat_b_b13 == 0 // assign 0 to 665 people who didn't have apprentice

* B19: Do you own this property where you work, or do you rent it from someone else?
gen cat_b_b19 = .
replace cat_b_b19 = 1 	if b_b19 == 1
replace cat_b_b19 = 0 	if b_b19 == 2

* B20: How much do you think you could receive in monthly rent if you were to rent out this workspace?
* B21: How much do you pay in monthly rent?
gen con_b_b20 = b_b20 			if cat_b_b19 == 1
winsor2 con_b_b20, replace cuts(1 99)
qui sum con_b_b20, de
replace con_b_b20 = `r(mean)' 	if cat_b_b19 == 1 & con_b_b20 == . // 1 obs missing
replace con_b_b20 = b_b21 		if cat_b_b19 == 0

* B22: RA: Is this business operated out of the respondent’s home?
gen cat_b_b22 = .
replace cat_b_b22 = 1 	if b_b22 == 1
replace cat_b_b22 = 0 	if b_b22 == 2

* B23: If you were to sell all the business-related equipment you own right now (such as chairs, machines and tools), how much do you think you could make?
* B24: Could you give me a range of the amount you would make if you sold all business-related equipment?
gen con_b_b23 = b_b23
replace con_b_b23 = 375000 		if con_b_b23 == . & b_b24 == 2
replace con_b_b23 = 875000 		if con_b_b23 == . & b_b24 == 4
replace con_b_b23 = 1750000 	if con_b_b23 == . & b_b24 == 6
replace con_b_b23 = 2500000 	if con_b_b23 == . & b_b24 == 7
winsor2 con_b_b23, replace cuts(1 99)
qui sum con_b_b23, de
replace con_b_b23 = `r(mean)' 	if con_b_b23 == . // 9 obs missing

* B25: If you were to sell all the inventory you own right now (e.g. fabric, thread, soap), how much do you think you could make?
* B26: Could you give me a range of the amount you would make if you sold all inventory?
gen con_b_b25 = b_b25
replace con_b_b25 = 125000 		if con_b_b25 == . & b_b26 == 1
replace con_b_b25 = 625000 		if con_b_b25 == . & b_b26 == 3
replace con_b_b25 = 1250000 	if con_b_b25 == . & b_b26 == 5
replace con_b_b25 = 4000000 	if con_b_b25 == . & b_b26 == 8
winsor2 con_b_b25, replace cuts(1 99)
qui sum con_b_b25, de
replace con_b_b25 = `r(mean)' 	if con_b_b25 == . // 9 obs missing

* B27: Over the past 7 days, how many hours did you work at this business?
gen con_b_b27 = b_b27
qui sum con_b_b27, de
replace con_b_b27 = `r(mean)' 	if con_b_b27 == . // 3 obs missing

* B28: How many people from your household, other than you, currently work at this business?
gen con_b_b28 = b_b28
replace con_b_b28 = 0 	if con_b_b28 == . & con_b_p3 == 1 // assign 0 if no answer to this question and household only has 1 person

* B29: Over the last 7 days, how much did you pay the members of your household in total?
replace b_b29 = b_b29 * 1000 if b_b29 < 1000
gen con_b_b29 = b_b29
winsor2 con_b_b29, replace cuts(1 99)
qui sum con_b_b29, de
replace con_b_b29 = `r(mean)' 	if con_b_b28 != 0 & con_b_b29 == . // 1 obs missing
replace con_b_b29 = 0 			if con_b_b28 == 0 & con_b_b29 == . // assign 0 to 1249 people with no household member workers

* B30: In the past 7 days, how many total hours did members work without pay?
gen con_b_b30 = b_b30 
qui sum con_b_b30, de
replace con_b_b30 = `r(mean)' 	if con_b_b28 != 0 & con_b_b30 == . // 4 obs missing
replace con_b_b30 = 0 			if con_b_b28 == 0 & con_b_b30 == . // assign 0 to 1249 people with no household member workers

* B31: How many paid employees from outside of your household currently work in this business?
gen con_b_b31 = b_b31

* B32: Over the last 7 days, how much did you pay employees from outside of your household in total?
replace b_b32 = 0 if b_b32 < 0
gen con_b_b32 = b_b32 			if con_b_b31 != 0
winsor2 con_b_b32, replace cuts(1 99)
qui sum con_b_b32, de
replace con_b_b32 = `r(mean)' 	if con_b_b31 != 0 & con_b_b32 == . // 7 obs missing
replace con_b_b32 = 0 			if con_b_b31 == 0 & con_b_b32 == . // assign 0 to 1093 people with no outside employers

* B33: Are any of your employees from a different tribe than you?
gen cat_b_b33 = .
replace cat_b_b33 = 1 	if b_b33 == 1
replace cat_b_b33 = 0 	if b_b33 == 2 
replace cat_b_b33 = -97 if con_b_b31 == 0 & cat_b_b33 == . // 1093 people have no outside workers

* B34: Are any of your employees from a different country than you?
gen cat_b_b34 = .
replace cat_b_b34 = 1 	if b_b34 == 1
replace cat_b_b34 = 0 	if b_b34 == 2
replace cat_b_b34 = -97 if con_b_b31 == 0 & cat_b_b34 == . // 1093 people have no outside workers

* B35: Which nationalities?
// multiple responses

* B36: How much revenue did this business earn in the last 30 days?
* B37: For the revenue of this business over the last 30 days, would you be able to tell me a range?
gen con_b_b36 = b_b36 // no need to update with range b_b37
winsor2 con_b_b36, replace cuts(1 99)

* B38: What were the profits of your business during the last 30 days?
* B39: For the profit of this business over the last 30 days, would you be able to tell me a range?
gen con_b_b38 = b_b38 // no need to update with range b_b39 
replace con_b_b38 = br_b38 if br_b38 != . // no need to update with range b_b39 
winsor2 con_b_b38, replace cuts(1 99)
qui sum con_b_b38, de
replace con_b_b38 = `r(mean)' 	if con_b_b38 == . // 6 obs missing
gen tcon_b_b38 = con_b_b38 // for summary statistics

* B40: Over the last 30 days, how much money did you invest into upgrading your business?
replace b_b40 = b_b40 * -1 if b_b40 < 0
gen con_b_b40 = b_b40
winsor2 con_b_b40, replace cuts(1 99)
qui sum con_b_b40, de
replace con_b_b40 = `r(mean)' 	if con_b_b40 == . // 6 obs missing

* B41: Over the past year, how often did you spend money advertising your business? Every day, every week, every month, a couple times, or never?
gen lik_b_b41 = b_b41

* B42: How often did you keep written books/accounting records? Always, frequently, sometimes, occasionally, or never?
gen lik_b_b42 = b_b42

* B43: How often did you sell goods or provide services to customers on credit? For all sales, most sales, some sales, a few sales, or never?
gen lik_b_b43 = b_b43

* B44: How often did you buy materials, tools, or machines for your business on credit? For all sales, most sales, some sales, a few sales, or never?
gen lik_b_b44 = b_b44 
qui sum lik_b_b44, de
replace lik_b_b44 = `r(p50)' if lik_b_b44 == . // 2 obs missing
	 
* B45: In the past year, how many times did you take out a loan for your business?
replace b_b45 = 1 if b_b45 > 1000
replace b_b45 = . if b_b45 == -999
gen con_b_b45 = b_b45
qui sum con_b_b45, de
replace con_b_b45 = `r(mean)' 	if con_b_b45 == . // 2 obs missing

* B46: What is the main reason that you did not apply for a loan for your business?
gen cat_b_b46 = b_b46
replace cat_b_b46 = -97 	if con_b_b45 != 0 & cat_b_b46 == . // 321 people applied for loan

* B47: Do you currently have any business-related loans or outstanding debts to be paid back?
gen cat_b_b47 = .
replace cat_b_b47 = 1 	if b_b47 == 1
replace cat_b_b47 = 0 	if b_b47 == 2

* B48: How much total business-related debt do you currently have?
gen con_b_b48 = b_b48 		if cat_b_b47 == 1
winsor2 con_b_b48, replace cuts(1 99)
qui sum con_b_b48, de
replace con_b_b48 = `r(mean)' 	if con_b_b48 == . & cat_b_b47 == 1 // 1 obs missing
replace con_b_b48 = 0 			if cat_b_b47 == 0 // 1202 people have no debt

* B49: How much of that is owed to formal lenders such as banks/MFIs?
gen con_b_b49 = b_b49 		if cat_b_b47 == 1
winsor2 con_b_b49, replace cuts(1 99)
qui sum con_b_b49, de
replace con_b_b49 = `r(mean)' 	if con_b_b49 == . & cat_b_b47 == 1 // 1 obs missing
replace con_b_b49 = 0 			if cat_b_b47 == 0 // 1202 people have no debt

* B50: Suppose you wanted more credit for your business right now. What is the largest loan you think you could acquire from a bank/MFI?
replace b_b50 = . if b_b50 == -999
gen con_b_b50 = b_b50
winsor2 con_b_b50, replace cuts(1 99)
qui sum con_b_b50, de
replace con_b_b50 = `r(mean)' 	if con_b_b50 == . // 58 obs missing

* B51: What is the largest loan you think you could acquire from informal sources (such as family, friends, SACCO, moneylender)?
replace b_b51 = . if b_b51 == -999 |  b_b51 == -9999
gen con_b_b51 = b_b51
winsor2 con_b_b51, replace cuts(1 99)
qui sum con_b_b51, de
replace con_b_b51 = `r(mean)' 	if con_b_b51 == . // 47 obs missing

* B52: In the past year, has this business increased its number of employees, number of machines, or space occupied?
gen cat_b_b52 = .
replace cat_b_b52 = 1 	if b_b52 == 1
replace cat_b_b52 = 0 	if b_b52 == 2 
replace cat_b_b52 = -97 if con_b_b1 == 2019 // 278 people's business was established < 1 year

***** Module C
* C1: Think about all of your business’ customers. How many of your customers are Ugandans from your tribe? All, most, some, few, or none?
gen cat_b_c1 = . 	// 17 people choose don't know
// variables generated at the end of module C: 1 = all/most, 0 = few/none, -99 don't know

* C2: How many of your customers are Ugandans from a different tribe? All, most, some, few, or none?
gen cat_b_c2 = . 	// 8 people choose don't know

* C3: How many of your customers are from another country? All, most, some, few, or none?
gen cat_b_c3 = .  	// 19 people choose don't know

* C4: Which nationalities?
// multiple responses

* C5: In the last 30 days, have you bought supplies (such as materials for your business), tools, or machines from someone from another country?
gen cat_b_c5 = .
replace cat_b_c5 = 1 	if b_c5 == 1 //YES
replace cat_b_c5 = 0 	if b_c5 == 2 //NO

* C6: Which countries did they come from?
// multiple responses

* C7: Do you collaborate with any other businesses in your industry?
gen cat_b_c7 = .
replace cat_b_c7 = 1 	if b_c7 == 1
replace cat_b_c7 = 0 	if b_c7 == 2

* C8: How do you collaborate?
// multiple responses

* C9: How many of your business collaborators are Ugandans from your tribe?
gen con_b_c9 = b_c9 		if cat_b_c7 == 1
qui sum con_b_c9, de
replace con_b_c9 = `r(mean)' 	if con_b_c9 == . & cat_b_c7 == 1 // 9 obs mssing
replace con_b_c9 = 0 			if con_b_c9 == . & cat_b_c7 == 0 // 492 people don't collaborate

* C10: How many of your business collaborators are Ugandans from a different tribe?
gen con_b_c10 = b_c10 		if cat_b_c7 == 1
qui sum con_b_c10, de
replace con_b_c10 = `r(mean)' 	if con_b_c10 == . & cat_b_c7 == 1 // 9 obs mssing
replace con_b_c10 = 0 			if con_b_c10 == . & cat_b_c7 == 0 // 492 people don't collaborate

* C11: Would you be open to collaborating with Ugandans from other tribes?
gen cat_b_c11 = .
replace cat_b_c11 = 1 	if b_c11 == 1
replace cat_b_c11 = 0 	if b_c11 == 2
replace cat_b_c11 = 1 	if con_b_c10 > 0 & con_b_c10 < . & cat_b_c11 == . // assign 1 to 700(691) who collobrate with other tribes
replace cat_b_c11 = 0 	if cat_b_c7 == 0 & cat_b_c11 == . // assign 0 to 492 who don't colloborate with others

* C12: How many of your business collaborators are from another country?
gen con_b_c12 = b_c12 			if cat_b_c7 == 1
qui sum con_b_c12, de
replace con_b_c12 = `r(mean)' 	if con_b_c12 == . & cat_b_c7 == 1 // 4 obs mssing
replace con_b_c12 = 0 			if con_b_c12 == . & cat_b_c7 == 0 // assign 0 to 492 people don't collaborate
gen dummy_b_c12 = con_b_c12 > 0 if con_b_c12 != .

* C13: What countries?
// multiple responses

* C14: Would you be open to collaborating with business owners from another country?
gen cat_b_c14 = .
replace cat_b_c14 = 1 	if b_c14 == 1
replace cat_b_c14 = 0 	if b_c14 == 2
replace cat_b_c14 = 1 	if con_b_c12 > 0 & con_b_c12 < . & cat_b_c14 == . // assign 1 to 153(149) who collobrate with foreigners
replace cat_b_c14 = 0 	if cat_b_c7 == 0 & cat_b_c14 == . // assign 0 to 492 who don't colloborate with others

* C15: How many businesses in this area are managed by Ugandans from your tribe? All, most, some, few, or none?
gen cat_b_c15 = . // 105 obs missing

* C16: How many businesses in this area are managed by Ugandans from a different tribe?
gen cat_b_c16 = . // 89 obs missing

* C17: How many businesses in this area are managed by people from another country?
gen cat_b_c17 = . // 241 obs missing

* C18: What countries?
// multiple responses

* C19: Are all of the businesses in this area your competitors?
gen cat_b_c19 = .
replace cat_b_c19 = 1 	if b_c19 == 1
replace cat_b_c19 = 0 	if b_c19 == 2

* C20: Why not?
// multiple responses

* C21: How do the businesses managed by Ugandans from your tribe affect your business overall?
gen cat_b_c21 = . // 111 not applicable, skipped if b_c15 = 5

* C22: How about the businesses managed by Ugandans from a different tribe?
gen cat_b_c22 = . // 29 not applicable, skipped if b_c16 = 5

* C23: How about the businesses managed by people from other countries?
gen cat_b_c23 = . // 833 not applicable, skipped if b_c17 = 5

* C24: Is your business officially registered?
gen cat_b_c24 = .
replace cat_b_c24 = 1 	if b_c24 == 1
replace cat_b_c24 = 0 	if b_c24 == 2

* C25: With whom is this business registered?
// multiple responses

* C26: How satisfied are you with the LC1 for this area?
gen cat_b_c26 = . 
replace b_c26 = . if b_c26 == 6 // 32 no opinion/don't know/decline

* C27: How satisfied are you with the MP for this area?
gen cat_b_c27 = . 
replace b_c27 = . if b_c27 == 6 // 175 no opinion/don't know/decline

* C1, C2, C3, C15, C16, C17, C21, C22, C23, C26, C27 // don't know/not applicable
foreach var in c1 c2 c3 c15 c16 c17 c26 c27 {
	qui sum b_`var', de
	replace cat_b_`var' = (b_`var' <= 3)	if b_`var' != . & `r(mean)' >= 3 	
	replace cat_b_`var' = (b_`var' < 3) 	if b_`var' != . & `r(mean)' < 3 
	replace cat_b_`var' = -99 				if cat_b_`var' == .
}

foreach var in c21 c22 c23 {
	qui sum b_`var', de
	replace cat_b_`var' = (b_`var' <= 3)	if b_`var' != . & `r(mean)' >= 3 	
	replace cat_b_`var' = (b_`var' < 3) 	if b_`var' != . & `r(mean)' < 3 
	replace cat_b_`var' = -97 				if cat_b_`var' == .
}

***** Module D
* D1: Is this business the main source of income for your household?
gen cat_b_d1 = .
replace cat_b_d1 = 1 	if b_d1 == 1
replace cat_b_d1 = 0 	if b_d1 == 2

* D2: Do you share all of your profits from this business with your spouse?
gen cat_b_d2 = .
replace cat_b_d2 = 1 	if b_d2 == 1 
replace cat_b_d2 = 0 	if b_d2 == 2
replace cat_b_d2 = 0 	if cat_b_d2 == . & cat_b_p2 != 1 // assign 0 (no) to 734 people who are not married

* D3: Who decides how the household's money is spent?
gen cat_b_d3 = b_d3
replace cat_b_d3 = 1 	if cat_b_d3 == . & cat_b_p2 != 1 // assign 1 (I do) to 734 people who are not married

* D4: Do you or any of your household members own any additional businesses?
gen cat_b_d4 = .
replace cat_b_d4 = 1 	if b_d4 == 1
replace cat_b_d4 = 0 	if b_d4 == 2

* D5: What were the profits of all of those other businesses (excluding this one) during the last 30 days?
* D6: For the profit of those other business over the last 30 days, would you be able to tell me a range?
gen con_b_d5 = b_d5 	if cat_b_d4 == 1
qui sum con_b_d5, de
replace con_b_d5 = 62500 	if cat_b_d4 == 1 & b_d6 == 4
replace con_b_d5 = 87500 	if cat_b_d4 == 1 & b_d6 == 5
replace con_b_d5 = 250000 	if cat_b_d4 == 1 & b_d6 == 8
replace con_b_d5 = 400000 	if cat_b_d4 == 1 & b_d6 == 9
replace con_b_d5 = 750000 	if cat_b_d4 == 1 & b_d6 == 10
replace con_b_d5 = `r(p99)' if cat_b_d4 == 1 & b_d6 == 11
winsor2 con_b_d5, replace cuts(1 99)
qui sum con_b_d5, de
replace con_b_d5 = `r(mean)' 	if con_b_d5 == . & cat_b_d4 == 1 // 67 obs mssing
replace con_b_d5 = 0 			if con_b_d5 == . & cat_b_d4 == 0 // assign 0 to 924 people who don't own additional business

* D7: Did you earn any wage income in the last 30 days?
gen cat_b_d7 = .
replace cat_b_d7 = 1 	if b_d7 == 1
replace cat_b_d7 = 0 	if b_d7 == 2

* D8: How much wage income did you earn in the last 30 days?
* D9: For your wage income over the last 30 days, would you be able to tell me a range? // no update
gen con_b_d8 = b_d8 	if cat_b_d7 == 1
winsor2 con_b_d8, replace cuts(1 99)
qui sum con_b_d8, de
replace con_b_d8 = `r(mean)' 	if con_b_d8 == . & cat_b_d7 == 1 // 2 obs mssing
replace con_b_d8 = 0 			if con_b_d8 == . & cat_b_d7 == 0 // assign 0 to 1278 people who didn't earn any wage income

* D10: In the last 30 days, did any members of your household other than you earn any wage income? Don’t include wages paid by a business that you or your household owns. 
gen cat_b_d10 = .
replace cat_b_d10 = 1 	if b_d10 == 1
replace cat_b_d10 = 0 	if b_d10 == 2
replace cat_b_d10 = 0 	if b_d10 == . & con_b_p3 == 1 // assign 0 to 295 people whose HH member = 1

* D11: How much wage income did they earn in the last 30 days? Don’t include wages paid by a business you own.
* D12: For their wage income over the last 30 days, would you be able to tell me a range?
gen con_b_d11 = b_d11 		if cat_b_d10 == 1
replace con_b_d11 = 250000 	if cat_b_d10 == 1 & b_d12 == 8
replace con_b_d11 = 400000 	if cat_b_d10 == 1 & b_d12 == 9
winsor2 con_b_d11, replace cuts(1 99)
qui sum con_b_d11, de
replace con_b_d11 = `r(mean)' 	if con_b_d11 == . & cat_b_d10 == 1 // 53 obs mssing
replace con_b_d11 = 0 			if con_b_d11 == . & cat_b_d10 == 0 // assign 0 to 1181 people whose family member didn't earn wage income

* D13: How much money was your household able to save in the past 30 days?
* D14: For your household savings over the last 30 days, would you be able to tell me a range?
replace b_d13 = . if b_d13 == -999
gen con_b_d13 = b_d13
replace con_b_d13 = 62500 	if con_b_d13 == . & b_d14 == 4
replace con_b_d13 = 250000 	if con_b_d13 == . & b_d14 == 8
replace con_b_d13 = 400000 	if con_b_d13 == . & b_d14 == 9
replace con_b_d13 = 750000 	if con_b_d13 == . & b_d14 == 10
winsor2 con_b_d13, replace cuts(1 99)
qui sum con_b_d13, de
replace con_b_d13 = `r(mean)' 	if con_b_d13 == . // 60 obs mssing

* D15: Over the past 30 days, how often have you or anyone in your household: Gone without enough food to eat? Always, often, sometimes, or never?
gen lik_b_d15 = b_d15

* D16: Over the past 30 days, how often have you or anyone in your household: Struggled to afford basic household expenses (such as medicine, rent, school fees)?
gen lik_b_d16 = b_d16

* D17: In the past 30 days, have you or anyone in your household had to sell assets (jewelry, furniture, clothing, tools, machines, land) in order to afford basic household expenses?
gen cat_b_d17 = .
replace cat_b_d17 = 1 	if b_d17 == 1
replace cat_b_d17 = 0 	if b_d17 == 2

* D18: In the past 30 days, has your household had to stop education for a child due to lack of finances?
gen cat_b_d18 = .
replace cat_b_d18 = 1 	if b_d18 == 1
replace cat_b_d18 = 0 	if b_d18 == 2
replace cat_b_d18 = 0 	if cat_b_d18 == . & con_b_p4 == 0 // assign 0 (No) to 429 people who have no child

* D19: Over the past year, has your household received any assistance from an NGO or international organization?
gen cat_b_d19 = .
replace cat_b_d19 = 1 	if b_d19 == 1
replace cat_b_d19 = 0 	if b_d19 == 2

* D20: What type of assistance?
// multiple responses

* D21: Which organizations did you receive assistance from?
gen cat_b_d21 = b_d21
replace cat_b_d21 = "None" if cat_b_d21 == "" & cat_b_d19 == 0 // assign None to 1388 people who didn't receive help from NGO

* S22: Can you estimate the total value of this assistance over the past year?
gen con_b_s22 = b_s22
replace con_b_s22 = 0 if con_b_s22 < 0
winsor2 con_b_s22, replace cuts(1 99)
qui sum con_b_s22, de
replace con_b_s22 = `r(mean)' 	if con_b_s22 == . & cat_b_d19 == 1 // 3 obs mssing
replace con_b_s22 = 0 			if con_b_s22 == . & cat_b_d19 == 0 // assign 0 to 1388 people who didn't receive help from NGO


***** Module E
* E1: Do you live in ?
gen cat_b_e1 = .
replace cat_b_e1 = 1 	if b_e1 == 1
replace cat_b_e1 = 0 	if b_e1 == 2

*E2: Which village do you live in?
gen cat_b_village_name = b_village_name_code

* E3: Is the LC1 for your home the same as for your business?
gen cat_b_e3 = .
replace cat_b_e3 = 1 	if b_e3 == 1
replace cat_b_e3 = 0 	if b_e3 == 2
replace cat_b_e3 = 1 	if cat_b_e1 == 1 
replace cat_b_e3 = -99 	if cat_b_e3 == . // 4 people missing whether LC1 for home is the same as for business 

* E4: How satisfied are you with the LC1 for your home neighborhood?
replace b_e4 = b_c26 	if cat_b_e3 == 1
replace b_e4 = . 		if b_e4 == 6 // no opinion/don't know/decline
gen cat_b_e4 = .
// 4 people missing whether LC1 for home is the same as for business

* E5: Is the MP for your home the same as for your business?
gen cat_b_e5 = .
replace cat_b_e5 = 1 	if b_e5 == 1
replace cat_b_e5 = 0 	if b_e5 == 2
replace cat_b_e5 = 1 	if cat_b_e3 == 1 
replace cat_b_e5 = -99 	if cat_b_e5 == . // 6 people missing whether MP for home is the same as for business

* E6: How satisfied are you with the MP for your home neighborhood?
replace b_e6 = b_c27 	if cat_b_e5 == 1
replace b_e6 = . 		if b_e6 == 6 // no opinion/don't know/decline
gen cat_b_e6 = .
// 6 people missing whether MP for home is the same as for business

* E4, E6 // don't know/not applicable
foreach var in e4 e6 {
	qui sum b_`var', de
	replace cat_b_`var' = (b_`var' <= 3)	if b_`var' != . & `r(mean)' >= 3 	
	replace cat_b_`var' = (b_`var' < 3) 	if b_`var' != . & `r(mean)' < 3 
	replace cat_b_`var' = -99 				if cat_b_`var' == .
}
replace cat_b_e4 = -99 	if cat_b_e3 == -99
replace cat_b_e6 = -99 	if cat_b_e5 == -99

* E7: Compared to the average Ugandan in ${E1}, how would you describe the economic situation of your household? Much better, somewhat better, about the same, somewhat worse, or much worse?
gen lik_b_e7 = b_e7

* E8: In Uganda, there are people who came here from another country. In your opinion, do these people have any positive effects on Uganda?
gen cat_b_e8 = .
replace cat_b_e8 = 1 if b_e8 == 1
replace cat_b_e8 = 0 if b_e8 == 2

* E9: What positive effects do they have on Uganda?
// multiple responses

* E10: In your opinion, do people from other countries in Uganda have any negative effects on Uganda?
gen cat_b_e10 = .
replace cat_b_e10 = 1 if b_e10 == 1
replace cat_b_e10 = 0 if b_e10 == 2

* E11: What negative effects do they have on Uganda?
// multiple responses

* E12: How many people from other countries live in [village_name]? Many, some, few, or none?
gen lik_b_e12 = b_e12

* E13: Which countries do they mostly come from?
// multiple responses

* E14: In the past 30 days, how many people from another country have you contacted for any social reason, such as having a long conversation?
gen con_b_e14 = b_e14 
qui sum con_b_e14, de
replace con_b_e14 = `r(mean)' if con_b_e14 == . // 8 obs missing

* E15: Which nationalities?
// multiple responses

* E16: In the past 30 days, how many Ugandans from different tribe have you contacted for any social reason, such as having a long conversation?
gen con_b_e16 = b_e16 
qui sum con_b_e16, de
replace con_b_e16 = `r(mean)' if con_b_e16 == . // 12 obs missing

* E17: What social activities do you participate in with people from other countries?
// multiple responses

* E18: Which countries are they from?
// multiple responses

* E19: How safe do you feel walking around most areas in Kampala? Very safe, somewhat safe, neutral, somewhat unsafe, or very unsafe?
gen lik_b_e19 = b_e19

* E20: How safe do you feel walking around areas in Kampala where people from other countries live? You can say very safe, somewhat safe, neutral, somewhat unsafe, very unsafe, or that it depends on the nationality."
gen lik_b_e20 = b_e20
replace lik_b_e20 = 3 	if lik_b_e20 == 6 // replace 6 (It depends on the nationality) with 3 (Neutral)

* E21: For which nationalities do you usually feel safe?
// multiple responses

* E22: For which nationalities do you usually feel unsafe?
// multiple responses

* E23: Is there tension between Ugandans and people from other nationalities?
gen cat_b_e23 = .
replace cat_b_e23 = 1 if b_e23 == 1
replace cat_b_e23 = 0 if b_e23 == 2

* E24: Which nationalities?
// multiple responses

// E25: In your opinion, what is the source of the tension
// text

* E26: How many serious conflicts have you witnessed or been involved in between Ugandans and people from other nationalities over the past year?
replace b_e26 = . if b_e26 == -999
gen con_b_e26 = b_e26 
qui sum con_b_e26, de
replace con_b_e26 = `r(mean)' if con_b_e26 == . // 6 obs missing

* E27: Were you involved in any of these conflicts?
gen cat_b_e27 = .
replace cat_b_e27 = 1 if b_e27 == 1
replace cat_b_e27 = 0 if b_e27 == 2
replace cat_b_e27 = 0 if con_b_e26 == 0 
replace cat_b_e27 = 0 if cat_b_e27 == . // 6 obs missing

* E28: What were the conflicts over?
// text

* E29: Which nationalities were involved?
// multiple responses

* E30: What were the genders of those involved?
// multiple responses

***** Module F
* F1: Some of the foreigners in Uganda are refugees. Which countries are refugees in Uganda from? 
// multiple responses

* F2: How many of the Congolese living in Uganda are refugees? All, most, some, or few?
* F3: How many of the South Sudanese living in Uganda are refugees? All, most, some, or few?
* F4: How many of the Somalis living in Uganda are refugees? All, most, some, or few?
* F5: How many of the Ethiopians living in Uganda are refugees? All, most, some, or few?
* F6: How many of the Kenyans living in Uganda are refugees? All, most, some, or few?
* F7: How many of the Rwandans living in Uganda are refugees? All, most, some, or few?
* F8: How many of the Burundians living in Uganda are refugees? All, most, some, or few?
foreach var in f2 f3 f4 f5 f6 f7 f8 {
	gen cat_b_`var' = .
	qui sum b_`var', de
	replace cat_b_`var' = (b_`var' <= 2)	if b_`var' != .
	replace cat_b_`var' = -99 				if cat_b_`var' == .
}

* F9: In your opinion, do refugees have any positive effects on Uganda?
gen cat_b_f9 = .
replace cat_b_f9 = 1 if b_f9 == 1
replace cat_b_f9 = 0 if b_f9 == 2

* F10: What positive effects do they have on Uganda?
// multiple responses

* F11: In your opinion, do refugees have any negative effects on Uganda?
gen cat_b_f11 = .
replace cat_b_f11 = 1 if b_f11 == 1
replace cat_b_f11 = 0 if b_f11 == 2

* F12: What negative effects do they have on Uganda?
// multiple responses

* F13: How many of the refugees in Uganda live outside of camps or settlements: all, most, some, few, or none?
// "Some" or "Few" will be considered correct
gen cat_b_f13 = 0
replace cat_b_f13 = 1 	if b_f13 == 3 | b_f13 == 4
	
* F14: Are refugees allowed to live outside of the camps or settlements?
// "Yes" is correct
gen cat_b_f14 = 0
replace cat_b_f14 = 1 	if b_f14 == 1

* F15: Are any of the international donations to refugees in Uganda shared with Ugandans?
// "Yes" is correct
gen cat_b_f15 = 0
replace cat_b_f15 = 1 	if b_f15 == 1

* F16: How many refugees have a lot of money?
gen cat_b_f16 = . // 143 people don't know

* F17: How many refugees deserve sympathy and support?
gen cat_b_f17 = . // 52 people don't know

* F18: How many refugees get more assistance than they need?
gen cat_b_f18 = . // 234 people don't know

* F19: How many refugees are able to support themselves financially without assistance?
gen cat_b_f19 = . // 128 people don't know

* F20: How many refugees have skills and contribute to the economy?
gen cat_b_f20 = . // 152 people don't know

* F16, F17, F18, F19, F20
foreach var in f16 f17 f18 f19 f20 {
	qui sum b_`var', de
	replace cat_b_`var' = (b_`var' <= 3)	if b_`var' != . & `r(mean)' >= 3 	
	replace cat_b_`var' = (b_`var' < 3) 	if b_`var' != . & `r(mean)' < 3 
	replace cat_b_`var' = -99 				if cat_b_`var' == .
}

***** Module G
* G1 - G11 Economic and social beliefs generally
foreach var in g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 g11 {
	gen cat_b_`var' = .
	qui sum b_`var', de
	replace cat_b_`var' = (b_`var' <= 3)	if b_`var' != . & `r(mean)' >= 3 	
	replace cat_b_`var' = (b_`var' < 3) 	if b_`var' != . & `r(mean)' < 3  
	replace cat_b_`var' = -99 				if cat_b_`var' == .	
}

* G12 - G21 Economic and social beliefs generally
foreach var in g12 g13 g14 g15 g16 g17 g18 g19 g20 g21 {
	gen cat_b_`var' = b_`var'
	replace cat_b_`var' = -99 				if cat_b_`var' == .	
}

***** Module J
* J1 - J8 Political beliefs, humanitarian attitudes, and policy preferences
foreach var in j1 j2 j3 j4 j5 j6 j8 {
	gen lik_b_`var' = b_`var'
	replace lik_b_`var' = 3 	if lik_b_`var' == 6 // replace 6 (It depends on the nationality) with 3 (Neutral)
}

* J7: For refugees who are already in Uganda, which option do you think Uganda should follow: 
gen cat_b_j7 = b_j7

* J9: For foreigners, besides refugees, which option do you think Uganda should follow:
gen cat_b_j9 = b_j9

***** Module K
* K1 - K16: Social distance
foreach var in k1 k2 k3 k4 k5 k6 k7 k8 k9 k10 k11 k12 k13 k14 k15 k16 {
	gen lik_b_`var' = b_`var'
}

replace lik_b_k3 = 1 if lik_b_k1 == 1 & lik_b_k2 == 1
replace lik_b_k4 = 1 if lik_b_k1 == 1 & lik_b_k2 == 1

replace lik_b_k7 = 1 if lik_b_k5 == 1 & lik_b_k6 == 1
replace lik_b_k8 = 1 if lik_b_k5 == 1 & lik_b_k6 == 1

replace lik_b_k11 = 1 if lik_b_k9 == 1 & lik_b_k10 == 1
replace lik_b_k12 = 1 if lik_b_k9 == 1 & lik_b_k10 == 1

replace lik_b_k15 = 1 if lik_b_k13 == 1 & lik_b_k14 == 1
replace lik_b_k16 = 1 if lik_b_k13 == 1 & lik_b_k14 == 1

foreach var in k1 k2 k3 k4 k5 k6 k7 k8 {
	replace lik_b_`var' = 3 	if lik_b_`var' == 6 // replace 6 (It depends on the nationality/tribe) with 3 (Neutral)
}

***** Module L
* L1: Where do you get your news?
// multiple responses

* L2: Which of those sources would you say is your MAIN source of news?
gen cat_b_l2 = b_l2
replace cat_b_l2 = 1 	if b_l1 == "1"
replace cat_b_l2 = 2 	if b_l1 == "2"
replace cat_b_l2 = 3 	if b_l1 == "3"
replace cat_b_l2 = 4 	if b_l1 == "4"
replace cat_b_l2 = 5 	if b_l1 == "5"
replace cat_b_l2 = 6 	if b_l1 == "6" // I do not get news
replace cat_b_l2 = 7 	if b_l1 == "7" // other

* L3 L5 L7 L9
foreach var in l3 l5 l7 l9 {
	gen lik_b_`var' = b_`var'
}
replace lik_b_l9 = 5 	if lik_b_l9 == 6 // replace 6 (No religious leaders) with 5 (Never)

* L4 L6 L8 L10
foreach var in l4 l6 l8 l10 {
	gen cat_b_`var' = b_`var'
	replace cat_b_`var' = -97 	if cat_b_`var' == .
}

***** Module N
* N1: Our research team has an extra UGX available. We can give it to you or share it between you and two charity organizations in Uganda. The first charity helps poor Ugandans living in Kampala. The second charity helps refugees living in Kampala. We are going to let you decide how to split the money. How much of the UGX should we give to the charity supporting poor Ugandans in Kampala?
gen con_b_n1 = b_n1

gen con_b_n2 = b_n2

*======= LASSO Preparation ======*

***** Likert variables
foreach var of varlist lik_* {
	qui tab `var'
	qui replace `var' = (`var' <= 2) 	if `r(r)' == 4
	if `r(r)' == 4 global lik4_list ${lik4_list} `var'
}
display "${lik4_list}" // all 4-category likert variables

foreach var of varlist lik_* {
	qui sum `var', detail
	local mean = `r(mean)'
	qui tab `var'
	qui replace `var' = (`var' <= 3) 	if `r(r)' > 4 & `mean' >= 3
	qui replace `var' = (`var' <  3) 	if `r(r)' > 4 & `mean' <  3
	if `r(r)' > 4 global lik5_list ${lik5_list} `var'
}

gen lik_b_j2_tmp = 1 - lik_b_j2
drop lik_b_j2
rename lik_b_j2_tmp lik_b_j2 // disagree w relocation means support

display "${lik5_list}" // all 5-category likert variables

foreach var of varlist lik_b* {
	global lik_list ${lik_list} `var'
}
display "${lik_list}" // all likert variables

***** Continuous variables
foreach var of varlist ls_e9 b_b12 b_b20 b_b23 b_b25 b_b29 b_b32 b_b36 b_b38 b_b40 b_b48 b_b49 b_b50 b_b51 b_d5 b_d8 b_d11 b_d13 b_s22 {
	replace con_`var' = asinh(con_`var')
} // take inverse hyperbolic sine for monetary measures

foreach var of varlist con_b* {
	global con_list ${con_list} `var'
}
display "${con_list}" // all continuous variables

***** Categorical variables
foreach var of varlist cat_b* {
	qui tab `var', gen(`var'_)
	order `var'_*, a(`var')
	qui drop `var'
	global cat_list ${cat_list} `var'_*
}
display "${cat_list}" // all categorical variables

